package com.apexsoft.test.sample.ams.controller;


import com.alibaba.fastjson.JSONObject;
import com.apexsoft.aas.util.security.AES;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class SwaggerController {

    @RequestMapping("swagger1")
    @ApiOperation(value = "swagger测试1", httpMethod = "POST")
    public JSONObject swagger1() {
        return new JSONObject() {{
            put("code", 1);
            put("note", "访问成功");
        }};

    }

    @RequestMapping("swagger2")
    @ApiOperation(value = "swagger测试1", httpMethod = "POST",
    response = RetData.class)
    public JSONObject swagger2(@RequestBody  Data data) {
        return new JSONObject() {{
            put("code", 1);
            put("note", "访问成功");
        }};

    }

    @ApiModel
    public static class Data{
        @ApiModelProperty(notes = "字段1")
        private String param1;
        @ApiModelProperty(notes = "字段2")
        private String param2;

        public String getParam1() {
            return param1;
        }

        public void setParam1(String param1) {
            this.param1 = param1;
        }

        public String getParam2() {
            return param2;
        }

        public void setParam2(String param2) {
            this.param2 = param2;
        }
    }


    @ApiModel
    public static class RetData{
        @ApiModelProperty(notes = "字段1")
        private String param1;
        @ApiModelProperty(notes = "字段2")
        private String param2;

        public String getParam1() {
            return param1;
        }

        public void setParam1(String param1) {
            this.param1 = param1;
        }

        public String getParam2() {
            return param2;
        }

        public void setParam2(String param2) {
            this.param2 = param2;
        }
    }
}
